package cn.itcast;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
//伪装
@EnableFeignClients
//后面的熔断会用到
@EnableCircuitBreaker
//@EnableEurekaClient:这是对eureka用的，如果用的是其他的注册中心可用@EnableDiscoveryClient
@EnableEurekaClient
//(exclude = DataSourceAutoConfiguration.class)用jpa则就要用这个去掉自动配置，否则有时候会报错，如不加报entityMangement错的时候就是这里的错误
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
//@SpringCloudApplication 这个是前面三个注释的和，可以不写前面三个只写这一个，效果应该是一样的，还没试过
public class ConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class);
    }
//    @Bean
//    //负载均衡@LoadBalanced，加了减少很多步骤
//    @LoadBalanced
//    public RestTemplate restTemplate(){
//        return new RestTemplate();
//    }
}
